#include <bits/stdc++.h>
using namespace std;
int a[27];
int main()
{
  string s;
  cin>>s;
  for(int i = 0;i<s.size();i++)
  {
    a[s[i]-'a']++;
  }
  char ret1;
  int ret = 0;
  for(int i = 25;i>=0;i--)
  {
    if(a[i]>=ret)
    {
      ret = a[i];
      ret1 = i+'a';
    }
  }
  cout<<ret1<<endl<<ret;
  return 0;
}
